Digital signal processing (DSP) is finding widespread use in modern computing applications. Formerly, digital signal processing operations were typically performed by dedicated processors with specialized instruction sets. There is an incentive to enable conventional microprocessors with the capability of performing efficient digital signal processing, thereby eliminating the need for a dedicated processor in a variety of applications.
Binary number representations are employed in microprocessors and digital signal processors. Intermediate calculations associated with digital signal processing operations often have greater accuracy (in terms of the number of bits employed to represent a number) than the operands. When calculations are complete, the result often has to be reformatted to the same precision as the original operands, or to some other required level of precision less than that of the intermediate calculation. The process of reformatting requires shifting the result a number of positions to the right to scale the value. Additionally, the scaled result may be checked for overflow and underflow with respect to the highest and lowest number that can be represented with the number of bits available to the formatted result. If the scaled result is larger than the greatest number that can be represented with the specified number of bits (i.e., an overflow condition), the scaled result is set to the greatest number that can be represented with the specified number of bits.
If the scaled result is smaller than the smallest number that can be represented with the specified number of bits (i.e., an underflow condition), the scaled result is set to the smallest number that can be represented with the specified number of bits. The operation of setting the scaled value upon an overflow and an underflow condition is referred to as saturation, or as a saturate operation. Skilled artisans will appreciate that saturation operations are known and employed in commercial microprocessor architectures. For example, the ARM 11, Version 6 microarchitecture family, available from ARM Ltd, Cambridge, England, provides two instructions, ssat and usat that perform signed and unsigned saturation respectively. However, the ssat and usat instructions provided by the ARM 11 microarchitecture do not provide a rounding capability (to be discussed infra). The absence of the rounding capability limits the usefulness of the ssat and the usat instructions.
A number scaled by right shifting biases the result by always producing a value that is always lower than or equal to the correct result. What is needed is a method for efficiently scaling the results of digital signal processing computations such as multiply-accumulate operations without producing a bias in the results. An efficient formatting method would significantly increase the performance of digital signal processing algorithms implemented in microprocessors and would avoid the need to perform a series of cumbersome operations to provide a scaled result without bias.